<style>
        #element_to_pop_up_{ 
            background-color:#fff;
            box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.298);
            border-radius:5px;
            color:#000;
            display:none; 
            padding:5px;
            min-width:800px;
            min-height: 500px;   
        }
        .b-close{
            cursor:pointer;
            position:absolute;
            right:10px;
            top:5px;            
        } 

    </style>
<div id="element_to_pop_up_">
        <a class="b-close">X</a>                    
        <div class="widget grid12">
            <div class="whead"><h6>INGRESO AL ALMACEN </h6><div class="clear"></div></div>
              <div id="listaventas" style="overflow:scroll;height:500px;width:800px;">
              
              </div> 
        </div>
</div> 
<div class="widget">
    <div class="whead"><h6>PRODUCTOS TRANSFERIDOS</h6><div class="clear"></div></div>
    
    <div class="shownpars">
    <?php if(empty($venta)):?>
    <div class="formRow">
    <?php
    echo $this->Form->create('Ventasproducto', array('action' => 'ajaxlistado'));
   ?>
        <div class="grid2"><label>Sucursal:<span class="req">*</span></label></div>
        <div class="grid3">
            <?php echo $this->Form->select('sucursal_transferido', $sucursales, array('id' => 'seleccionasucursal','required','class' => 'select','data-placeholder' => 'A TRANSFERIR')); ?>
        </div>

        <div class="grid3">
        <?php
        $this->Js->get('#seleccionasucursal')->event(
                                            'change',
                                            $this->Js->request(
                                                array('action' => 'ajaxsucursal'),
                                                array('async' => true,
                                                'update' => '#prueba',
                                                'method' => 'post','dataExpression'=>true,
                                                'data'=> $this->Js->serializeForm(array('isForm' => true,'inline' => true))))
                                            );
        echo $this->Form->end();
        ?>
        </div>
        <div id="prueba">
        </div>
        
        
        <div class="clear"></div>
    </div>
    <?php else:?>
    <div class="formRow">
    
        <div class="grid2"><label>Sucursal a Transferir:</label></div>
        <div class="grid3">
         <h4><?php echo $venta['Transferida']['nombre']?></h4>
         </div>
        <div class="grid3">
        <input type="button"  id="adiventa"value="ADICIONAR PRODUCTO" class="buttonS bGreen"/>   
        </div>
        <?php 
                                            $this->Js->get('#adiventa')->event(
                                            'click',
                                            $this->Js->request(
                                                array('controller' => 'Ventasproductos','action' => 'ajaxproductostransferencias',$venta['Ventasproducto']['id']),
                                                array(
                                                'async' => true,
                                                'before' => 'ajaxIngreso();',
                                                'update' => '#listaventas'))
                                            );?>
        <div class="grid2">
        <?php echo $this->Html->link('Cancelar Transferencia',array('action' => 'cancelaventa',$venta['Ventasproducto']['id'],1),array('class' => 'buttonS bRed'));?>
        </div>
        <div class="grid2">
        <?php echo $this->Html->link('IMPRIMIR NOTA',array('action' => 'notatransferencia',$venta['Ventasproducto']['id']),array('class' => 'buttonS bGreyish'));?>
        </div>
        <div class="clear"></div>
    </div>
    <?php endif;?>
    <div >
    <table cellpadding="0" cellspacing="0" border="0" class="dTable">
            <thead>
                    <tr>
                        <th>Codigo</th>
                        <th>Nombre</th>
                        <th>Micaje</th>
                        <th>Alto</th>
                        <th>Peso</th>
                        <th>Sucursal</th>
                        <th>Accion</th>
                    </tr>
                </thead>
            <tbody>
                    <?php  $i = 0; $total = 0.00; ?>
                <?php if(!empty($productos)):?>    
                <?php foreach ($productos as $pro):$i++;  ?>
                
                <tr>
                    
                    <td><?php echo $pro['Cortestubo']['codigo']; ?></td>
                    <td><?php echo $pro['Tubo']['nombre']; ?></td>
                    <td><?php echo $pro['Tubo']['micraje']; ?></td>
                    <td ><?php echo $pro['Cortestubo']['alto']; ?></td>
                    <td ><?php echo $pro['Cortestubo']['peso']; ?></td>
                    <td><?php echo $pro['Sucursale']['nombre']; ?></td>
                    <td><?php echo $this->Html->link('Quitar',array('action' => 'quita',$venta['Ventasproducto']['id'],$pro['Cortestubo']['id']),array('class' => 'tablectrl_small bRed tipS'));?></td>
                    
                </tr>
                
            <?php endforeach; ?>
            <?php endif;?>
                </tbody>
        </table>
        
    </div>
        
    </div> 
</div>
<script>
function ajaxIngreso() {
        $('#element_to_pop_up_').bPopup({
            fadeSpeed: 'slow', //can be a string ('slow'/'fast') or int
            followSpeed: 1500
        });
    }
</script> 
<?php echo $this->Js->writeBuffer(); ?>